home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Controls
/
Visual Basic Controls.iso
/
vbcontrol
/
whoisx
/
WHOCOM5.FRM
< prev
next >
Wrap
Text File
|
1998-11-17
|
10KB
|
316 lines
VERSION 5.00
Begin VB.Form Form1
Caption = "WhoIs/X COM Sample"
ClientHeight = 7920
ClientLeft = 1980
ClientTop = 1500
ClientWidth = 6945
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 7920
ScaleWidth = 6945
Begin VB.CheckBox Check1
Caption = "Use Fast Notifications"
Height = 255
Left = 5040
TabIndex = 13
Top = 600
Width = 1935
End
Begin VB.ListBox List1
Height = 1230
Left = 240
TabIndex = 8
Top = 6600
Width = 6495
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "Courier New"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2775
Left = 240
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 6
Top = 3480
Width = 6495
End
Begin VB.ComboBox Combo2
Height = 315
Left = 1320
TabIndex = 0
Text = "Combo2"
Top = 480
Width = 3615
End
Begin VB.CommandButton Command1
Caption = "Who Is"
Default = -1 'True
Height = 375
Left = 5040
TabIndex = 2
Top = 120
Width = 1575
End
Begin VB.ComboBox Combo1
Height = 315
Left = 1320
Style = 2 'Dropdown List
TabIndex = 1
Top = 120
Width = 3615
End
Begin VB.Label Label8
Caption = "To query a specific handle, preface the query with the ""!"" character, such as: !MABRY-DOM."
Height = 375
Left = 240
TabIndex = 12
Top = 1080
Width = 5655
End
Begin VB.Label Label7
Caption = $"WhoCOM5.frx":0000
Height = 615
Left = 240
TabIndex = 11
Top = 1560
Width = 6015
End
Begin VB.Label Label6
Caption = $"WhoCOM5.frx":00C8
Height = 495
Left = 240
TabIndex = 10
Top = 2760
Width = 6015
End
Begin VB.Label Label5
Caption = $"WhoCOM5.frx":0166
Height = 495
Left = 240
TabIndex = 9
Top = 2280
Width = 6135
End
Begin VB.Label Label4
Caption = "Status:"
Height = 255
Left = 240
TabIndex = 7
Top = 6360
Width = 735
End
Begin VB.Label Label3
Caption = "Select a pre-defined Query value, or type one in."
Height = 255
Left = 240
TabIndex = 5
Top = 840
Width = 4215
End
Begin VB.Line Line1
X1 = 240
X2 = 6720
Y1 = 3360
Y2 = 3360
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "WhoIs Query:"
Height = 255
Left = 120
TabIndex = 4
Top = 480
Width = 1095
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "WhoIs Server:"
Height = 255
Left = 120
TabIndex = 3
Top = 120
Width = 1095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim WithEvents WhoisX As WhoisXCom
Attribute WhoisX.VB_VarHelpID = -1
Implements IWhoisXComNotify
Private Sub Check1_Click()
If Check1.Value = vbChecked Then
'if the user enables Fast Notifications
'have the object pass the notifications
'directly to the form
Check1.Enabled = False
WhoisX.NotificationObject = Me
End If
End Sub
Private Sub Command1_Click()
On Error Resume Next
'bail, if no query is set
If Combo1.Text = "" Then
Exit Sub
End If
'peel the description from the name
'server
WhoisX.Host = Left$(Combo1.Text, InStr(Combo1.Text, " ") - 1)
'
'set the Query
WhoisX.Query = Combo2.Text
'
'set a Timeout
WhoisX.Timeout = 5
'
'non-blocking mode
WhoisX.Blocking = False
'
'clear the old results
Text1.Text = ""
'clear the progress list
List1.Clear
'
'get the results
Command1.Enabled = False
MousePointer = 11
'perform the query
WhoisX.GetWhoIs
If Err.Number <> 0 Then
List1.AddItem CStr(Err.Number)
Command1.Enabled = True
MousePointer = 0
End If
End Sub
Private Sub Form_Load()
'create the object
Set WhoisX = New WhoisXCom
'load some database servers
Combo1.AddItem "whois.internic.net - North American domains"
Combo1.AddItem "whois.nic.mil - Military domains"
Combo1.AddItem "whois.nic.gov - Government domains"
Combo1.AddItem "whois.arin.net - American Registry domains"
Combo1.AddItem "whois.ripe.net - European domains"
Combo1.AddItem "whois.apnic.net - Asia Pacific domains"
Combo1.ListIndex = 0
'pre-load some queries
Combo2.AddItem "mabry.com"
Combo2.AddItem "mabry"
Combo2.AddItem "@mabry"
Combo2.AddItem "james@mabry.com"
Combo2.AddItem "!MABRY-DOM"
Combo2.ListIndex = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
'practice safe programming -- destroy the object when finished
On Error Resume Next
Set WhoisX = Nothing
End Sub
Private Sub IWhoisXCOMNotify_Done(ByVal SocketObject As WhoisXObj.IWhoisXCom, ByVal LastMethod As WhoisXObj.MethodsEnum, ByVal ErrorCode As Integer)
Dim l As Long
'
'we are finished
If ErrorCode = 0 Then
'no error occurred, so we loop through
'the responses and display the results
For l = 0 To WhoisX.ResponseCount - 1
Text1.Text = Text1.Text & WhoisX.Response(l) & vbCrLf
Next l
List1.AddItem "Done"
Else
'some error occurred
Debug.Print CStr(Err.Number)
Debug.Print CStr(ErrorCode)
Debug.Print CStr(LastMethod)
List1.AddItem CStr(ErrorCode) & " " & Err.Description
End If
're-enable the button
Command1.Enabled = True
MousePointer = 0
End Sub
Private Sub IWhoisXComNotify_StateChanged(ByVal WhoisObject As WhoisXObj.IWhoisXCom, ByVal OldState As WhoisXObj.StatesEnum, ByVal NewState As WhoisXObj.StatesEnum)
'keep the user informed as to
'what is transpiring
Select Case NewState
Case 0
List1.AddItem "No usable socket library loaded."
Case 1
List1.AddItem "Socket closed."
Case 2
List1.AddItem "Socket created."
Case 3
List1.AddItem "Connecting..."
Case 4
List1.AddItem "Connected to host."
Case 5
List1.AddItem "Waiting for response..."
Case 6
List1.AddItem "Retrieving response..."
Case 7